import 'package:flutter/material.dart';

import 'test008.dart';

class Test007 extends StatefulWidget {
  const Test007({super.key});

  @override
  State<Test007> createState() => _Test007State();
}

class _Test007State extends State<Test007> with SingleTickerProviderStateMixin {
  late AnimationController _controller;
  String path = "images/icon_home_car.png";

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(vsync: this);
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("动画"),
      ),
      body: Center(
        child: GestureDetector(
          onTap: () {
            Navigator.push(
              context,
              MaterialPageRoute(
                builder: (BuildContext context) {
                  return Test008(path);
                },
              ),
            );
          },
          child: Hero(
            tag: path,
            child: Image.asset(
              path,
              width: 100,
              height: 40,
            ),
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          Navigator.push(
            context,
            MaterialPageRoute(
              builder: (BuildContext context) {
                return Test008(path);
              },
            ),
          );
        },
        child: const Icon(Icons.ads_click),
      ),
    );
  }
}
